package com.xxx.util;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class GetIdTime {

    /**
     * 获取时间戳
     * @return
     */
    public static long getId(){
        Instant now = Instant.now();
        long second = now.getEpochSecond();
        return second;
    }

    /**
     * 获取时间信息
     */
    public static String getDataTime(){
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime now = LocalDateTime.now();
        String format = formatter.format(now);
        return format;
    }
}
